<script setup lang="ts">
import { ref } from 'vue'
import DEFAULT_ICON from "../assets/default.png"

defineProps<{ name: string; icon: string }>()
</script>

<template>
  <div class="app">
    <picture class="pic">
      <source :srcset="icon" />
      <img :src="DEFAULT_ICON" alt="App Icon" />
    </picture>
    <div class="name">{{ name }}</div>
  </div>
</template>

<style scoped>
.app {
  width: 64px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
  transform: scale(1);
}

.app:hover {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transform: scale(1.03);
}

.app:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

.pic {
  width: 48px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
}

.pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}
</style>